package vsvm.gui.menus;

import javax.swing.JMenu;
import javax.swing.JMenuBar;

import vsvm.gui.IUpdatable;

public class MainMenu extends JMenuBar implements IUpdatable {
	private WindowMenu wMenu;
	private ObjectMenu oMenu;
	
	public MainMenu() {
		this.add(new FileMenu());
		this.add(new ViewMenu());
		this.add(oMenu = new ObjectMenu());
		this.add(wMenu = new WindowMenu());
		this.add(new HelpMenu());
	}
	
	public void update() {
		for (int i = 0; i < this.getMenuCount(); i++) {
			JMenu menu = this.getMenu(i);
			if (menu instanceof IUpdatable)
				((IUpdatable)menu).update();
		}		
	}
	
	public void updateWindows() {
		wMenu.update();		
	}

}
